#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int maxSubArray(int* nums, int numsSize){

    int sum = 0 , ans = -10000;
    for (int i = 0;i<numsSize;i++)
    {
        sum += nums[i];
        ans = ans < sum ? sum : ans;
        if (sum < 0)
            sum = 0;
    }
    return ans;

}

int main(void)
{
    int nums[] = {-1000,-100,-10};
    int result = maxSubArray(nums,3);
    printf("%d\n",result);
    return 0;
}